<style>
    .a_bg{background: #0059a3;}
    .a_banner{width:1200px;overflow:hidden;}
    .a_guize{background:#fff;padding:20px;}
    .a_guizetext{text-align: center;border-bottom:1px solid #ddd;line-height: 30px;padding-bottom: 20px;}
    .a_tips{line-height: 38px;margin-left:240px;}
    .a_tips2{line-height: 38px;margin-left:240px;}
    .urls{margin-left:10px;height:36px;border:1px solid #ccc;padding:0px 10px;line-height:36px;width:500px;}
    .a_tenpic{background:#f7931e;padding:15px;}
    .a_banner2{width:522px;margin:0px auto;}
    .a_ten_p_box{width:970px;height:80px;overflow:hidden;position: relative;background:url(<?php echo Yii::app()->baseUrl; ?>/images/activity/20140824/10r_bg.png) no-repeat 0px 0px;margin:20px auto;}
    .a_ten_p_cover{top:0px;left:0px;height:80px;overflow:hidden;position: absolute;background:url(<?php echo Yii::app()->baseUrl; ?>/images/activity/20140824/10r_cover.png) no-repeat 0px 0px;}
    .a_list{width:1172px}
    .a_list li{width:290px;float:left;margin-right:3px;margin-bottom:10px;}
    .a_list li .img{width:290px;height:190px;overflow:hidden;position:relative;}
    .a_list li .img .a_shadow{position:absolute;bottom:0px;left:0px;background:#000;opacity:0.7;filter:alpha(opacity=70);width:270px;padding:0px 10px;color:#fff;height:26px;line-height:26px;}
    .a_list li .img img{width:100%;}
    .a_list li .btns{background:#fff;padding:10px 70px;}
    .a_list li .btns a{text-align:center;}

    .a_rankbox{}
    .a_rankbox .a_titles{text-align:center;height:70px;line-height:70px;background:#29abe2;}
    .a_none{height:70px;line-height:70px;background:#fff;text-align:center;}

    .a_ranklist{}
    .a_ranklist li{height:50px;line-height:50px;overflow:hidden;padding:20px 30px;}
    .a_ranklist li.li_light{background:#4fc1e9;}
    .a_ranklist li.li_dark{background:#29abe2;}
    .a_ranklist li div{color:#fff;}
    .a_ranklist li .ranknum{font-size:18px;width:100px;}
    .a_ranklist li .rank_pic{font-size:18px;width:100px;}
    .a_ranklist li .rank_name{font-size:18px;width:200px;}
    .a_ranklist li .rank_count{font-size:18px;}
</style>
<div class="a_bg">
    <div class="wp">
        <div class="a_banner"><img src="<?php echo Yii::app()->baseUrl; ?>/images/activity/20140824/publicity.jpg"/></div>
        <div class="a_guize">
            <div class="a_guizetext">
                <div class="f_16"><b>活动规则</b></div>
                <div class="f_16">注册用户转发下方链接至好友,8月20日至9月18日,根据截止时间排名前三甲将获得相应礼品</div>
                <div class="f_14 c_gray2">仅已注册用户可发送邀请链接,已注册用户无法被邀请<span class="pipe">/</span>本次活动仅限于光谷、中南路、江汉路附近商圈</div>
            </div>
            <div class="cl tm10">
                <?php if (Yii::app()->user->isGuest): ?>
                    <div class="z a_tips f_14 c_gray">此活动需要灵动生活注册用户资格</div>
                    <a href="<?php echo Yii::app()->createUrl('site/login'); ?>" class="submit_green submit z">立即登录</a><a href="<?php echo Yii::app()->createUrl('site/register'); ?>" class="submit_green submit z lm15">注册新账号</a>
                <?php else: ?>
                    <div class="z a_tips2 f_14">你的邀请链接</div><div class="z urls f_14" id="myurl">http://www.ldfood.cn/register?pid=<?php echo Yii::app()->user->id; ?></div><a href="javascript:void(0);" class="copy-btns submit submit_green z lm15">复制链接</a>
                <?php endif; ?>
            </div>
        </div>
        <div class="a_rankbox tm10">
            <div class="a_titles f_20 c_f">排名榜</div>
            <?php if (count($row['GetUserPidRankRsp']['buyerRanks']) > 0): ?>
                <ul class="a_ranklist">
                    <?php foreach ($row['GetUserPidRankRsp']['buyerRanks'] as $key => $value) { ?>
                        <li class="cl<?php if ($key % 2 == 0): ?> li_light<?php else: ?> li_dark<?php endif; ?>">
                            <div class="ranknum z">第<?php echo $key + 1; ?>名</div>
                            <div class="rank_pic z"><img src="<?php echo !$value['url'] ? Yii::app()->baseUrl.'/images/icon50.jpg' : $value['url']; ?>"/></div>
                            <div class="rank_name z"><?php echo $value['userAccount']; ?></div>
                            <div class="rank_count z">成功邀请 <b><?php echo $value['count']; ?></b> 位好友注册</div>
                        </li>
                    <?php } ?>
                </ul>
            <?php else: ?>
                <div class="a_none f_20">快来做一位领袖，赶快去邀请小伙伴吧！</div>
            <?php endif; ?>
        </div>
    </div>
</div>
<SCRIPT>
    $(document).ready(function() {
        $(".copy-btns").click(function() {
            var Url = $("#myurl").text();
            copyToClipboard(Url);
        })
    });

    function copyToClipboard(maintext) {
        if (window.clipboardData) {
            window.clipboardData.setData("Text", maintext);
        } else if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            } catch (e) {
                alert("该浏览器不支持一键复制！\n请手工复制文本框链接地址～");
            }
            var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
            if (!clip)
                return;
            var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
            if (!trans)
                return;
            trans.addDataFlavor('text/unicode');
            var str = new Object();
            var len = new Object();
            var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
            var copytext = maintext;
            str.data = copytext;
            trans.setTransferData("text/unicode", str, copytext.length * 2);
            var clipid = Components.interfaces.nsIClipboard;
            if (!clip)
                return false;
            clip.setData(trans, null, clipid.kGlobalClipboard);
        }
        alert("以下内容已经复制到剪贴板\n" + maintext);
    }
</SCRIPT>